package com.company.java.basic.day01;
/*
逻辑运算符
逻辑与 &
    ture & ture = ture
    false & ture = false
    ture & false = false
    false & false = false
逻辑或
    ture  | ture = ture
    false |  ture = ture
    ture  | false = ture
    false |  false = false
逻辑非
    !ture = false
    !false= ture
逻辑异或(两个相同位true)
    ture  ^ ture = ture
    false ^  ture = false
    ture  ^ false = false
    false ^  false = ture
短路与(若第一个条件为false，则不计算第二个条件)
    ture && ture = ture
    false && ture = false
    ture && false = false
    false && false = false
短路或(若第一个条件为ture，则不计算第二个条件)
    ture  || ture = ture
    false ||  ture = ture
    ture  || false = ture
    false ||  false = false

 */
public class Day01_Logic {
    public static void main(String[] args) {
        int score = 20;
        if (score>=0 & score<=60){
            System.out.println("不及格");
        }
        //判段成绩是否有误
        if (score<0 | score>100){
            System.out.println("有误");
        }
        //判段成绩是合理
        if (!(score<0 | score>100)){
            System.out.println("合理");
        }
        //短路与、或经常使用
        int a =1;
        int b =2;
        if (a++ == 1 && ++a ==2){
            b++;
        }else {
            b--;
        }
        System.out.println(a);
        System.out.println(b);

    }
}
